<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <title>文章列表--layui后台管理模板 2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="resources/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="resources/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" id="dataFrm">
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            编号</span><input type="text" id="chanNo" style="color: #a3b8c4" class="layui-input chanNo" name="chanNo" lay-verify="required" readonly="readonly">
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            客户名称<span style="color:red">* </span><input type="text" style="color: #a3b8c4" readonly="readonly" id="chanCustName" class="layui-input chanCustName" name="chanCustName" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <!--<label class="layui-form-label"></label>-->
        <div class="layui-input-block">
            机会来源 <input type="text" class="layui-input chanSource" name="chanSource" style="color: #a3b8c4" readonly="readonly" placeholder="无">
            成功率<span style="color:red">* </span><input type="text" style="color: #a3b8c4" readonly="readonly" class="layui-input chanRate" name="chanRate" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            概要<span style="color:red">* </span><input type="text" style="color: #a3b8c4" readonly="readonly" class="layui-input chanTitle" name="chanTitle" lay-verify="required" >
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <!--<label class="layui-form-label">联系人:</label>-->
        <div class="layui-input-block">
            联系人<input type="text" class="layui-input chanLinkman" name="chanLinkman" placeholder="无" style="color: #a3b8c4" readonly="readonly">
            联系电话<input type="text" class="layui-input chanTelephone" name="chanTelephone" placeholder="无" style="color: #a3b8c4" readonly="readonly">
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            机会描述<span style="color:red">* </span><input type="text" style="color: #a3b8c4;height: 100px" readonly="readonly" class="layui-input chanDescription" name="chanDescription" lay-verify="required">
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            创建人<span style="color:red">* </span><input type="text" class="layui-input chanCreateBy" style="color: #a3b8c4" readonly="readonly" id="chanCreateBy" name="chanCreateBy" lay-verify="required"  th:value="${session.USER_SESSION.realname}">
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            创建时间<span style="color:red">* </span><input type="text" class="layui-input chanCreateDate" style="color: #a3b8c4" readonly="readonly" id="chanCreateDate" name="chanCreateDate" lay-verify="required"  th:value="${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd HH:mm:ss')}">
        </div>
    </div>
    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            指派者<input type="text" class="layui-input chanDueTo"  style="color: #a3b8c4" id="chanDueTo" name="chanDueTo" readonly="readonly">
        </div>
    </div>
    <div class="layui-form-item layui-row">
        <div class="layui-input-block">
            指派时间<input type="text" class="layui-input chanDueDate"  style="color: #a3b8c4" id="chanDueDate" name="chanDueDate" readonly="readonly">
        </div>
    </div>
    <hr>
    <!--<input type="text" style="width: 200px" id="text1" placeholder="请输入效果" class="layui-hide">-->
    <!--<button class="layui-btn-warm layui-hide" id="saveResult">保存该效果</button>-->
    <table id="devPlan" lay-filter="devPlan">
        <tr id="plan" name="" class="plan" lay-filter="plan"></tr>
    </table>
    <!--操作-->
    <script type="text/html" id="devPlanListBar">
        <a class="layui-btn layui-btn-xs development layui-icon-rss" lay-event="result">效果</a>
        <a class="layui-btn layui-btn-xs development layui-icon-rss" lay-event="details">详情</a>
    </script>
</form>
<div class="layui-form-item layui-row layui-col-xs12">

</div>
<script type="text/javascript" src="resources/layui/layui.js"></script>
<script th:inline="none">
    layui.use(['form','layer','laydate','table','laytpl','upload'],function() {
        var form = layui.form
        layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table,
            upload=layui.upload;

        //获取当前行数据，并且实现删除，编辑等功能
        table.on("tool(devPlan)",function (obj) {
            //获取当前行的数据
            var data=obj.data;
            switch (obj.event){//得到的就是点击lay-event中的值
                case 'result':
                    result(data);
                    break;
                case 'details':
                    details(data);
                    break;
            }
        });
        //得到销售机会的编号
        var chanNo=$("#chanNo").val();
        //底部的开发计划列表
        var tableIns = table.render({
            elem: '#devPlan',//渲染的表格
            url : 'findDevPlanByChanNo.do',
            // page : true,
            // limit : 10,
            // limits : [8,10,15,20,25],
            where: {chanNo:chanNo},
            id : "devPlanListTable",
            cols : [[
                //{field: 'planNo', title: '计划编号',align:"center",width: 150},
                {field: 'planDate', title: '日期',align:"center",width: 170},
                {field: 'planItem', title: '计划项',align:"center",width:450},
                {field: 'planResult', title: '执行效果',align:"center",width:450},
                {title: '操作', width:150, templet:'#devPlanListBar',fixed:"right",align:"center"}
            ]]
        });
        //这里是点击效果之后就会出现一个弹框，弹框可以模仿编辑开发客户的弹框
        function result(data) {
            // $("#text1").removeAttr('class','layui-hide');
            // $("#saveResult").removeAttr('class','layui-hide');
            // alert(data.planNo);
            var index=layui.layer.open({
                title:"效果",
                type:2,
                area:['500px','400px'],
                content:"toImportResult.do",
                success:function (layero,index) {
                    var body =layui.layer.getChildFrame('body', index);//少了这个是不能从父页面向子页面传值的
                    body.contents().find("#planNo").val(data.planNo);
                    body.contents().find("#planDate").val(data.planDate);
                    body.contents().find("#planItem").val(data.planItem);
                    body.contents().find("#planResult").val(data.planResult);
                    body.contents().find("#planState").val(data.planState);
                }
            });
        }
        //详情页
        function details(data) {
            var index=layui.layer.open({
                title:"效果",
                type:2,
                content:"toDetails.do",
                success:function (layero,index) {
                    var body =layui.layer.getChildFrame('body', index);//少了这个是不能从父页面向子页面传值的
                    body.contents().find("#planNo").val(data.planNo);
                    body.contents().find("#planDate").val(data.planDate);
                    body.contents().find("#planItem").val(data.planItem);
                    body.contents().find("#planResult").val(data.planResult);
                    body.contents().find("#planState").val(data.planState);
                }
            });layui.layer.full(index);//全屏显示
        }


    });
</script>
</body>
</html>